package com.bw.zg5_demo_2.ui;

import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.alibaba.android.arouter.launcher.ARouter;
import com.bw.Zg5_Demo_2.databinding.ActivitySplashBinding;
import com.bw.zg5_demo_2.common.Const;

import java.util.Timer;

public class SplashActivity extends AppCompatActivity {
    private ActivitySplashBinding binding;


    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        binding = ActivitySplashBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());


    }

    @Override
    protected void onResume() {
        super.onResume();
        CountDownTimer countDownTimer = new CountDownTimer(3000, 1000) {
            @Override
            public void onTick(long l) {
                binding.splashTimer.setText(String.format("倒计时:%s秒", l / 1000));
            }

            @Override
            public void onFinish() {
                ARouter.getInstance().build(Const.MAIN_PATH).navigation();
            }
        };
        countDownTimer.start();
    }
}